<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>EnTech FPK: C:/Users/Sam/Projects/FRC/Libraries/Fpk/Entech-Fpk-Subscribers/Entech-Fpk/Services/SelectorService.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">EnTech FPK
   &#160;<span id="projectnumber">1</span>
   </div>
   <div id="projectbrief">FRC Programming Kit by the EnTech 281 GreenVillains</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_e43c8660166cb86faa4173bc84e03276.html">Services</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">SelectorService.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// Have include guard.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#ifndef SELECTORCONTROLLER_H</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define SELECTORCONTROLLER_H</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">// Include files.</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;map&gt;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;WPILib.h&quot;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &quot;../Internal/FpkException.hpp&quot;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &quot;Service.hpp&quot;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &quot;../Inputs/HumanDigitalInput.hpp&quot;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &quot;../Inputs/DriverStationDigitalInput.hpp&quot;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &quot;../ValueOutputs/ValueOutput.hpp&quot;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &quot;../ValueOutputs/NullValueOutput.hpp&quot;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> Item&gt;</div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="code" href="class_selector_service.html">   24</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_selector_service.html">SelectorService</a> :</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;        <span class="keyword">public</span> <a class="code" href="class_service.html">Service</a></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;{</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;                <span class="keyword">typedef</span> std::pair&lt;std::string, Item&gt; NameItemPairType;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;                <span class="keyword">typedef</span> <span class="keyword">typename</span> std::vector&lt;NameItemPairType&gt;::size_type Size;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;                </div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;                <span class="comment">// Has to be up here to compile.</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;                Size m_indexCurrent;</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;                std::vector&lt;NameItemPairType&gt; m_nameItemPairs;</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;                <span class="keywordtype">bool</span> m_ownsInputs;</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;                <a class="code" href="class_human_digital_input.html">HumanDigitalInput</a> &amp;m_inputUp;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;                <a class="code" href="class_human_digital_input.html">HumanDigitalInput</a> &amp;m_inputDown;</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;                <span class="keywordtype">bool</span> m_inputsReleased;</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;                <a class="code" href="class_value_output.html">ValueOutput&lt;std::string&gt;</a> &amp;m_valueOutput;</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;                <a class="code" href="class_selector_service.html#abf147046e145822299d1627234634092">SelectorService</a></div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="code" href="class_selector_service.html#abf147046e145822299d1627234634092">   49</a></span>&#160;                (</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;                        <a class="code" href="class_human_digital_input.html">HumanDigitalInput</a> &amp;upInput, </div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;                        <a class="code" href="class_human_digital_input.html">HumanDigitalInput</a> &amp;downInput, </div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;                        <a class="code" href="class_value_output.html">ValueOutput&lt;std::string&gt;</a> &amp;valueOutput = <a class="code" href="class_null_value_output.html">NullValueOutput&lt;std::string&gt;::GetInstance</a>()</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;                ) :</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;                        m_indexCurrent(0),</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;                        m_ownsInputs(<span class="keyword">false</span>), </div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;                        m_inputUp(upInput), </div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;                        m_inputDown(downInput),</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;                        m_valueOutput(valueOutput)</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;                {</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;                }</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;                </div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;                <a class="code" href="class_selector_service.html#abf147046e145822299d1627234634092">SelectorService</a></div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="code" href="class_selector_service.html#adc403d822054db09aa8aa247af4ee37a">   71</a></span>&#160;                (</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;                        DriverStationEnhancedIO &amp;driverStationIo, </div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;                        UINT32 buttonUp, </div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;                        UINT32 buttonDown,</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;                        <a class="code" href="class_value_output.html">ValueOutput&lt;std::string&gt;</a> &amp;valueOutput = <a class="code" href="class_null_value_output.html">NullValueOutput&lt;std::string&gt;::GetInstance</a>()</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;                ) :</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;                        m_ownsInputs(<span class="keyword">true</span>), </div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;                        m_inputUp(*(<span class="keyword">new</span> <a class="code" href="class_driver_station_digital_input.html">DriverStationDigitalInput</a>(driverStationIo, buttonUp))), </div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;                        m_inputDown(*(<span class="keyword">new</span> <a class="code" href="class_driver_station_digital_input.html">DriverStationDigitalInput</a>(driverStationIo, buttonDown))),</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;                        m_valueOutput(valueOutput)</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;                {</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;                }</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;                </div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="code" href="class_selector_service.html#aa0f27a169ae3a7b8ef7e878f08308222">   87</a></span>&#160;                <span class="keyword">virtual</span> <a class="code" href="class_selector_service.html#aa0f27a169ae3a7b8ef7e878f08308222">~SelectorService</a>()</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;                {</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;                        <span class="keywordflow">if</span> (m_ownsInputs)</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;                        {</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;                                <span class="keyword">delete</span> &amp;m_inputUp;</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;                                <span class="keyword">delete</span> &amp;m_inputDown;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;                        }</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;                }</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;                </div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="code" href="class_selector_service.html#af888ea55bffe768dbc768f079e6517da">  102</a></span>&#160;                <span class="keywordtype">void</span> <a class="code" href="class_selector_service.html#af888ea55bffe768dbc768f079e6517da">AddItem</a>(std::string name, Item item)</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;                {</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;                        <span class="comment">// We don&#39;t want to add items when selection is possible.</span></div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;                        <span class="keywordflow">if</span> (!<a class="code" href="class_service.html#ac6ba2b89e56e24074c03c61254ab7f14">GetIsStarted</a>())</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;                        {</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;                                m_nameItemPairs.push_back(NameItemPairType(name, item));</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;                                <a class="code" href="class_selector_service.html#a309cdd8ce105ff5110856881cf5d83da">HandleItemAdded</a>(item);</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;                        }</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;                        <span class="keywordflow">else</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;                                <span class="keywordflow">throw</span> <a class="code" href="class_fpk_exception.html">FpkException</a>(<span class="stringliteral">&quot;SelectorController: Can not add item while controller is active.&quot;</span>);</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;                }</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;                </div>
<div class="line"><a name="l00119"></a><span class="lineno"><a class="code" href="class_selector_service.html#a3c9fe31741a72f237042c6d870290336">  119</a></span>&#160;                Item <a class="code" href="class_selector_service.html#a3c9fe31741a72f237042c6d870290336">GetSelectedItem</a>()</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;                {</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;                        <span class="keywordflow">return</span> m_nameItemPairs[m_indexCurrent].second;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;                }</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;                </div>
<div class="line"><a name="l00129"></a><span class="lineno"><a class="code" href="class_selector_service.html#a94d7e95c13e9528ee3ac4a4624905ae5">  129</a></span>&#160;                <span class="keyword">const</span> std::vector&lt;NameItemPairType&gt; &amp;<a class="code" href="class_selector_service.html#a94d7e95c13e9528ee3ac4a4624905ae5">GetNameItemPairs</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;<span class="keyword">                </span>{</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;                        <span class="keywordflow">return</span> m_nameItemPairs;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;                }</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;        <span class="keyword">protected</span>:</div>
<div class="line"><a name="l00137"></a><span class="lineno"><a class="code" href="class_selector_service.html#a422be7e8347b12f51baa756797b6a855">  137</a></span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_selector_service.html#a422be7e8347b12f51baa756797b6a855">HandleStart</a>()</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;                {</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;                        m_indexCurrent = 0;</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;                        </div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;                        <span class="keywordflow">if</span> (!GetIsInvalidIndex(m_indexCurrent))</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;                                HandleItemSelected(m_nameItemPairs[m_indexCurrent]);</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;                }</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;                </div>
<div class="line"><a name="l00148"></a><span class="lineno"><a class="code" href="class_selector_service.html#a0105771fb348849983bfd2f622928626">  148</a></span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_selector_service.html#a0105771fb348849983bfd2f622928626">HandleStop</a>()</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;                {</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;                        <span class="keywordflow">if</span>(!GetIsInvalidIndex(m_indexCurrent))</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;                                HandleItemUnselected(m_nameItemPairs[m_indexCurrent].second);</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;                }</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;                </div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="code" href="class_selector_service.html#a03e873370af26ecad1d1ac5a77d62c42">  157</a></span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_selector_service.html#a03e873370af26ecad1d1ac5a77d62c42">HandlePeriodic</a>()</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;                {</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;                        <span class="keywordflow">try</span></div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;                        {</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;                                <span class="keywordtype">bool</span> isIndexInvalid = GetIsInvalidIndex(m_indexCurrent);</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;                                </div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;                                <span class="keywordflow">if</span> (m_inputsReleased &amp;&amp; m_inputUp.<a class="code" href="class_human_digital_input.html#a46f14a7223295914e53d45dbe1a95fb2">Get</a>() &amp;&amp; !m_inputDown.<a class="code" href="class_human_digital_input.html#a46f14a7223295914e53d45dbe1a95fb2">Get</a>())</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;                                {</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;                                        <span class="keywordflow">if</span> (m_indexCurrent &gt; 0)</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;                                        {</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;                                                <span class="keywordflow">if</span> (!isIndexInvalid)</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;                                                        HandleItemUnselected(m_nameItemPairs[m_indexCurrent].second);</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;                                                </div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;                                                m_indexCurrent--;</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;                                                </div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;                                                HandleItemSelected(m_nameItemPairs[m_indexCurrent]);</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;                                                </div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;                                                m_inputsReleased = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;                                        }</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;                                }</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;                                <span class="keywordflow">else</span> <span class="keywordflow">if</span> (m_inputsReleased &amp;&amp; m_inputDown.<a class="code" href="class_human_digital_input.html#a46f14a7223295914e53d45dbe1a95fb2">Get</a>())</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;                                {</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;                                        <span class="keywordflow">if</span> (m_indexCurrent + 1 &lt; m_nameItemPairs.size())</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;                                        {</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;                                                <span class="keywordflow">if</span> (!isIndexInvalid)</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;                                                        HandleItemUnselected(m_nameItemPairs[m_indexCurrent].second);</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;                                                </div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;                                                m_indexCurrent++;</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;                                                </div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;                                                HandleItemSelected(m_nameItemPairs[m_indexCurrent]);</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;                                                </div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;                                                m_inputsReleased = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;                                        }</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;                                }</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;                                <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!m_inputUp.<a class="code" href="class_human_digital_input.html#a46f14a7223295914e53d45dbe1a95fb2">Get</a>() &amp;&amp; !m_inputDown.<a class="code" href="class_human_digital_input.html#a46f14a7223295914e53d45dbe1a95fb2">Get</a>())</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;                                        m_inputsReleased = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;                        }</div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;                        <span class="keywordflow">catch</span> (std::exception &amp;e)</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;                        {</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;                                printf(<span class="stringliteral">&quot;Selector Controller: Exception! &quot;</span>);</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;                                printf(e.what());</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;                                printf(<span class="stringliteral">&quot;\n&quot;</span>);</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;                        }</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;                        </div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;                        <span class="comment">//printf(&quot;Current drive mode: %s\n&quot;, m_nameItemPairs[m_indexCurrent].first.c_str());</span></div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;                }</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;                </div>
<div class="line"><a name="l00209"></a><span class="lineno"><a class="code" href="class_selector_service.html#a309cdd8ce105ff5110856881cf5d83da">  209</a></span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_selector_service.html#a309cdd8ce105ff5110856881cf5d83da">HandleItemAdded</a>(Item item)</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;                {</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;                }</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;                </div>
<div class="line"><a name="l00218"></a><span class="lineno"><a class="code" href="class_selector_service.html#ac85d4fafdcfd8817a64f2300d45f1c9e">  218</a></span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_selector_service.html#ac85d4fafdcfd8817a64f2300d45f1c9e">HandleItemSelectedImpl</a>(Item item)</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;                {</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;                }</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;                </div>
<div class="line"><a name="l00227"></a><span class="lineno"><a class="code" href="class_selector_service.html#ad2a5758dfbbedcf62cc0e4e8989570d4">  227</a></span>&#160;                <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_selector_service.html#ad2a5758dfbbedcf62cc0e4e8989570d4">HandleItemUnselectedImpl</a>(Item item)</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;                {</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;                }</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;                <span class="keywordtype">bool</span> GetIsInvalidIndex(Size index)</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;                {</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;                        <span class="keywordflow">return</span> !(index &gt;= 0) &amp;&amp; (index &lt; m_nameItemPairs.size());</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;                }</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;                </div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;                <span class="comment">// TODO: Remove &quot;Impl&quot; from protected event handlers and append &quot;Internal&quot; to internal event reaction code.</span></div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;                </div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;                <span class="keywordtype">void</span> HandleItemSelected(NameItemPairType item)</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;                {</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;                        m_valueOutput.<a class="code" href="class_value_output.html#a5af8591dc2dae95a38e2808abd0970c9">SetValue</a>(item.first);</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;                        </div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;                        <a class="code" href="class_selector_service.html#ac85d4fafdcfd8817a64f2300d45f1c9e">HandleItemSelectedImpl</a>(item.second);</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;                }</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;                </div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;                <span class="keywordtype">void</span> HandleItemUnselected(Item item)</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;                {</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;                        <a class="code" href="class_selector_service.html#ad2a5758dfbbedcf62cc0e4e8989570d4">HandleItemUnselectedImpl</a>(item);</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;                }</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;};</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;<span class="preprocessor">#endif // #ifndef SELECTORCONTROLLER_H </span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Aug 12 2013 16:46:49 for EnTech FPK by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3.1
</small></address>
</body>
</html>
